export const User = {
	state: {
		token: null,
		user: null
	},
	mutations: {
		SAVE_TOKEN(state, token) {
			state.token = token
		},
		SAVE_USER(state, user) {
			state.user = user
		},
		CLEAR_USER(state) {
			state.token = null
			state.user = null
		}
	},
	actions: {
		saveToken({ commit }, token) {
			commit('SAVE_TOKEN', token)
		},
		saveUser({ commit }, user) {
			commit('SAVE_USER', user)
		},
		clearUser({ commit }) {
			commit('CLEAR_USER')
		}
	}
}